package com.miao.springbootlearn.controller;


import org.smxxy.mqtt.config.MqttGateway;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class MqttController {

    @Resource
    MqttGateway mqttGateway;

    @PostMapping("/mqtt")
    public void SendMqtt(@RequestBody String content){

        String topic = "topic_test";
        mqttGateway.sendToMqtt(content, topic);
    }
}
